package com.neu.service;

import com.neu.dao.UserDao;
import com.neu.pojo.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Service
@Transactional
public class UserServiceImpl implements UserService {
    @Autowired
    private UserDao userDao;

    @Override
    public int addUser(User user) {
        return userDao.addUser(user);
    }

    @Override
    public int delUser(String userName) {
        return userDao.delUser(userName);
    }

    @Override
    public List<User> getUserByPage(int page, int limit) {
        return userDao.getUserByPage((page-1)*limit,limit);
    }

    @Override
    public int updateUser(User user) {
        return userDao.updateUser(user);
    }

    @Override
    public int getUserCount() {
        return userDao.getUserCount();
    }
}
